package com.lou1052.redis.jedis.source.cluster;

import com.lou1052.core.base.annotation.thread.ThreadSafe;
import com.lou1052.core.serializer.Serializer;
import com.lou1052.redis.config.ClusterConfig;
import com.lou1052.redis.config.ConfigType;
import com.lou1052.redis.config.NodeConfig;
import com.lou1052.redis.jedis.config.JedisConfig;
import com.lou1052.redis.jedis.config.PoolConfig;
import com.lou1052.redis.jedis.ext.client.cluster.JedisClusterExt;
import com.lou1052.redis.jedis.ext.client.single.JedisExt;
import com.lou1052.redis.jedis.ext.client.single.JedisExtPool;
import com.lou1052.redis.jedis.source.AbsJedisSource;
import com.lou1052.redis.jedis.util.SerSelector;
import org.apache.commons.pool2.PooledObject;
import redis.clients.jedis.*;

import javax.annotation.PreDestroy;
import java.util.*;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;

/**
 *
 * cluster redis
 * Created with IntelliJ IDEA.
 * User: liuqing
 * Date: 2015/10/14
 * Time: 22:41
 * To change this template use File | Settings | File Templates.
 */
@ThreadSafe
public class JedisClusterExtSource extends AbsJedisSource<JedisClusterExt> {

    private JedisClusterExt jedisCluster;
    /**
     * 连接池使用的Deque实现
     */
    private final Supplier<Deque<PooledObject<JedisExt>>> dequeSupplier;
    //关闭close方法
    private final NoCloseJedis noCloseJedis = new NoCloseJedis();

    public JedisClusterExtSource(JedisConfig jedisConfig, SerSelector serSelectors,boolean concurrent) {
        super(jedisConfig,serSelectors);
        if(concurrent){
            dequeSupplier = ConcurrentLinkedDeque::new;
        }else{
            dequeSupplier=null;//use default
        }
    }

    @Override
    public JedisClusterExt getSource() {
        return noCloseJedis;
    }

    /**
     * 关闭redis连接
     */
    @PreDestroy
    public void  close(){
        jedisCluster.close();
        logger.debug("close Cluster Redis clients");
    }

    /**
     * 初始化redis连接
     * @throws Exception
     */
    @Override
    public void afterPropertiesSet() throws Exception {
        if(jedisConfig.getConfigType()!= ConfigType.CLUSTER){
            throw  new IllegalArgumentException("JedisCluster init but config is not ConfigType.CLUSTER");
        }
        PoolConfig poolConfig = jedisConfig.getPoolConfig();
        NodeConfig nodeConfig = jedisConfig.getNodeConfig();
        ClusterConfig clusterConfig = jedisConfig.getClusterConfig();
        Set<HostAndPort> hosts = new HashSet<>();
        nodeConfig.getNodeInfoSet().forEach((nodeInfo -> {hosts.add(new HostAndPort(nodeInfo.getIp(),nodeInfo.getPort(),nodeInfo.getAuth()));}));
        jedisCluster = new JedisClusterExt(hosts, clusterConfig.getTimeout(), clusterConfig.getMaxRedirections(),poolConfig,serializerFunction,dequeSupplier);
        logger.debug("init Cluster Redis clients");
    }

    @Override
    public void destroy() throws Exception {
        jedisCluster.close();
        logger.debug("close Cluster Redis clients");
    }

    /**
     * 关闭close方法
     */
    private class NoCloseJedis extends JedisClusterExt{
        NoCloseJedis(){}

        @Override
        public Long append(byte[] key, byte[] value) {
            return jedisCluster.append(key, value);
        }

        @Override
        public Long append(String key, String value) {
            return jedisCluster.append(key, value);
        }

        @Override
        public String auth(String password) {
            return jedisCluster.auth(password);
        }

        @Override
        public String bgrewriteaof() {
            return jedisCluster.bgrewriteaof();
        }

        @Override
        public String bgsave() {
            return jedisCluster.bgsave();
        }

        @Override
        public Long bitcount(byte[] key) {
            return jedisCluster.bitcount(key);
        }

        @Override
        public Long bitcount(byte[] key, long start, long end) {
            return jedisCluster.bitcount(key, start, end);
        }

        @Override
        public Long bitcount(String key) {
            return jedisCluster.bitcount(key);
        }

        @Override
        public Long bitcount(String key, long start, long end) {
            return jedisCluster.bitcount(key, start, end);
        }

        @Override
        public List<byte[]> blpop(byte[] arg) {
            return jedisCluster.blpop(arg);
        }

        @Override
        public List<String> blpop(String arg) {
            return jedisCluster.blpop(arg);
        }

        @Override
        public List<String> blpop(int timeout, String key) {
            return jedisCluster.blpop(timeout, key);
        }

        @Override
        public List<byte[]> brpop(byte[] arg) {
            return jedisCluster.brpop(arg);
        }

        @Override
        public List<String> brpop(String arg) {
            return jedisCluster.brpop(arg);
        }

        @Override
        public List<String> brpop(int timeout, String key) {
            return jedisCluster.brpop(timeout, key);
        }

        @Override
        public void close() {
            //no close
        }

        @Override
        public String configResetStat() {
            return jedisCluster.configResetStat();
        }

        @Override
        public Long dbSize() {
            return jedisCluster.dbSize();
        }

        @Override
        public String debug(DebugParams params) {
            return jedisCluster.debug(params);
        }

        @Override
        public Long decr(byte[] key) {
            return jedisCluster.decr(key);
        }

        @Override
        public Long decr(String key) {
            return jedisCluster.decr(key);
        }

        @Override
        public Long decrBy(byte[] key, long integer) {
            return jedisCluster.decrBy(key, integer);
        }

        @Override
        public Long decrBy(String key, long integer) {
            return jedisCluster.decrBy(key, integer);
        }

        @Override
        public Long del(byte[] key) {
            return jedisCluster.del(key);
        }

        @Override
        public Long del(String key) {
            return jedisCluster.del(key);
        }

        @Override
        public byte[] echo(byte[] arg) {
            return jedisCluster.echo(arg);
        }

        @Override
        public String echo(String string) {
            return jedisCluster.echo(string);
        }

        @Override
        public Boolean exists(byte[] key) {
            return jedisCluster.exists(key);
        }

        @Override
        public Boolean exists(String key) {
            return jedisCluster.exists(key);
        }

        @Override
        public Long expire(byte[] key, int seconds) {
            return jedisCluster.expire(key, seconds);
        }

        @Override
        public Long expire(String key, int seconds) {
            return jedisCluster.expire(key, seconds);
        }

        @Override
        public Long expireAt(byte[] key, long unixTime) {
            return jedisCluster.expireAt(key, unixTime);
        }

        @Override
        public Long expireAt(String key, long unixTime) {
            return jedisCluster.expireAt(key, unixTime);
        }

        @Override
        public String flushAll() {
            return jedisCluster.flushAll();
        }

        @Override
        public String flushDB() {
            return jedisCluster.flushDB();
        }

        @Override
        public byte[] get(byte[] key) {
            return jedisCluster.get(key);
        }

        @Override
        public String get(String key) {
            return jedisCluster.get(key);
        }

        @Override
        public Boolean getbit(byte[] key, long offset) {
            return jedisCluster.getbit(key, offset);
        }

        @Override
        public Boolean getbit(String key, long offset) {
            return jedisCluster.getbit(key, offset);
        }

        @Override
        public Map<String, JedisExtPool> getClusterNodes() {
            return jedisCluster.getClusterNodes();
        }

        @Override
        public Long getDB() {
            return jedisCluster.getDB();
        }

        @Override
        public byte[] getrange(byte[] key, long startOffset, long endOffset) {
            return jedisCluster.getrange(key, startOffset, endOffset);
        }

        @Override
        public String getrange(String key, long startOffset, long endOffset) {
            return jedisCluster.getrange(key, startOffset, endOffset);
        }

        @Override
        public Serializer getSerializer(String key) {
            return jedisCluster.getSerializer(key);
        }

        @Override
        public byte[] getSet(byte[] key, byte[] value) {
            return jedisCluster.getSet(key, value);
        }

        @Override
        public String getSet(String key, String value) {
            return jedisCluster.getSet(key, value);
        }

        @Override
        public Long hdel(byte[] key, byte[]... field) {
            return jedisCluster.hdel(key, field);
        }

        @Override
        public Long hdel(String key, String... field) {
            return jedisCluster.hdel(key, field);
        }

        @Override
        public Boolean hexists(byte[] key, byte[] field) {
            return jedisCluster.hexists(key, field);
        }

        @Override
        public Boolean hexists(String key, String field) {
            return jedisCluster.hexists(key, field);
        }

        @Override
        public byte[] hget(byte[] key, byte[] field) {
            return jedisCluster.hget(key, field);
        }

        @Override
        public String hget(String key, String field) {
            return jedisCluster.hget(key, field);
        }

        @Override
        public Map<byte[], byte[]> hgetAll(byte[] key) {
            return jedisCluster.hgetAll(key);
        }

        @Override
        public Map<String, String> hgetAll(String key) {
            return jedisCluster.hgetAll(key);
        }

        @Override
        public Long hincrBy(byte[] key, byte[] field, long value) {
            return jedisCluster.hincrBy(key, field, value);
        }

        @Override
        public Long hincrBy(String key, String field, long value) {
            return jedisCluster.hincrBy(key, field, value);
        }

        @Override
        public Double hincrByFloat(byte[] key, byte[] field, double value) {
            return jedisCluster.hincrByFloat(key, field, value);
        }

        @Override
        public Set<byte[]> hkeys(byte[] key) {
            return jedisCluster.hkeys(key);
        }

        @Override
        public Set<String> hkeys(String key) {
            return jedisCluster.hkeys(key);
        }

        @Override
        public Long hlen(byte[] key) {
            return jedisCluster.hlen(key);
        }

        @Override
        public Long hlen(String key) {
            return jedisCluster.hlen(key);
        }

        @Override
        public List<byte[]> hmget(byte[] key, byte[]... fields) {
            return jedisCluster.hmget(key, fields);
        }

        @Override
        public List<String> hmget(String key, String... fields) {
            return jedisCluster.hmget(key, fields);
        }

        @Override
        public String hmset(byte[] key, Map<byte[], byte[]> hash) {
            return jedisCluster.hmset(key, hash);
        }

        @Override
        public String hmset(String key, Map<String, String> hash) {
            return jedisCluster.hmset(key, hash);
        }

        @Override
        public ScanResult<Map.Entry<String, String>> hscan(String key, int cursor) {
            return jedisCluster.hscan(key, cursor);
        }

        @Override
        public ScanResult<Map.Entry<String, String>> hscan(String key, String cursor) {
            return jedisCluster.hscan(key, cursor);
        }

        @Override
        public Long hset(byte[] key, byte[] field, byte[] value) {
            return jedisCluster.hset(key, field, value);
        }

        @Override
        public Long hset(String key, String field, String value) {
            return jedisCluster.hset(key, field, value);
        }

        @Override
        public Long hsetnx(byte[] key, byte[] field, byte[] value) {
            return jedisCluster.hsetnx(key, field, value);
        }

        @Override
        public Long hsetnx(String key, String field, String value) {
            return jedisCluster.hsetnx(key, field, value);
        }

        @Override
        public Collection<byte[]> hvals(byte[] key) {
            return jedisCluster.hvals(key);
        }

        @Override
        public List<String> hvals(String key) {
            return jedisCluster.hvals(key);
        }

        @Override
        public Long incr(byte[] key) {
            return jedisCluster.incr(key);
        }

        @Override
        public Long incr(String key) {
            return jedisCluster.incr(key);
        }

        @Override
        public Long incrBy(byte[] key, long integer) {
            return jedisCluster.incrBy(key, integer);
        }

        @Override
        public Long incrBy(String key, long integer) {
            return jedisCluster.incrBy(key, integer);
        }

        @Override
        public Double incrByFloat(byte[] key, double value) {
            return jedisCluster.incrByFloat(key, value);
        }

        @Override
        public Double incrByFloat(String key, double value) {
            return jedisCluster.incrByFloat(key, value);
        }

        @Override
        public String info() {
            return jedisCluster.info();
        }

        @Override
        public String info(String section) {
            return jedisCluster.info(section);
        }


        @Override
        public Long lastsave() {
            return jedisCluster.lastsave();
        }

        @Override
        public byte[] lindex(byte[] key, long index) {
            return jedisCluster.lindex(key, index);
        }

        @Override
        public String lindex(String key, long index) {
            return jedisCluster.lindex(key, index);
        }

        @Override
        public Long linsert(byte[] key, BinaryClient.LIST_POSITION where, byte[] pivot, byte[] value) {
            return jedisCluster.linsert(key, where, pivot, value);
        }

        @Override
        public Long linsert(String key, BinaryClient.LIST_POSITION where, String pivot, String value) {
            return jedisCluster.linsert(key, where, pivot, value);
        }

        @Override
        public Long llen(byte[] key) {
            return jedisCluster.llen(key);
        }

        @Override
        public Long llen(String key) {
            return jedisCluster.llen(key);
        }

        @Override
        public byte[] lpop(byte[] key) {
            return jedisCluster.lpop(key);
        }

        @Override
        public String lpop(String key) {
            return jedisCluster.lpop(key);
        }

        @Override
        public Long lpush(byte[] key, byte[]... args) {
            return jedisCluster.lpush(key, args);
        }

        @Override
        public Long lpush(String key, String... string) {
            return jedisCluster.lpush(key, string);
        }

        @Override
        public Long lpushx(byte[] key, byte[]... arg) {
            return jedisCluster.lpushx(key, arg);
        }

        @Override
        public Long lpushx(String key, String... string) {
            return jedisCluster.lpushx(key, string);
        }

        @Override
        public List<byte[]> lrange(byte[] key, long start, long end) {
            return jedisCluster.lrange(key, start, end);
        }

        @Override
        public List<String> lrange(String key, long start, long end) {
            return jedisCluster.lrange(key, start, end);
        }

        @Override
        public Long lrem(byte[] key, long count, byte[] value) {
            return jedisCluster.lrem(key, count, value);
        }

        @Override
        public Long lrem(String key, long count, String value) {
            return jedisCluster.lrem(key, count, value);
        }

        @Override
        public String lset(byte[] key, long index, byte[] value) {
            return jedisCluster.lset(key, index, value);
        }

        @Override
        public String lset(String key, long index, String value) {
            return jedisCluster.lset(key, index, value);
        }

        @Override
        public String ltrim(byte[] key, long start, long end) {
            return jedisCluster.ltrim(key, start, end);
        }

        @Override
        public String ltrim(String key, long start, long end) {
            return jedisCluster.ltrim(key, start, end);
        }

        @Override
        public Long move(byte[] key, int dbIndex) {
            return jedisCluster.move(key, dbIndex);
        }

        @Override
        public Long move(String key, int dbIndex) {
            return jedisCluster.move(key, dbIndex);
        }

        @Override
        public Long persist(byte[] key) {
            return jedisCluster.persist(key);
        }

        @Override
        public Long persist(String key) {
            return jedisCluster.persist(key);
        }

        @Override
        public Long pexpire(byte[] key, long milliseconds) {
            return jedisCluster.pexpire(key, milliseconds);
        }

        @Override
        public Long pexpire(String key, long milliseconds) {
            return jedisCluster.pexpire(key, milliseconds);
        }

        @Override
        public Long pexpireAt(byte[] key, long millisecondsTimestamp) {
            return jedisCluster.pexpireAt(key, millisecondsTimestamp);
        }

        @Override
        public Long pexpireAt(String key, long millisecondsTimestamp) {
            return jedisCluster.pexpireAt(key, millisecondsTimestamp);
        }

        @Override
        public Long pfadd(byte[] key, byte[]... elements) {
            return jedisCluster.pfadd(key, elements);
        }

        @Override
        public Long pfadd(String key, String... elements) {
            return jedisCluster.pfadd(key, elements);
        }

        @Override
        public long pfcount(byte[] key) {
            return jedisCluster.pfcount(key);
        }

        @Override
        public long pfcount(String key) {
            return jedisCluster.pfcount(key);
        }

        @Override
        public String ping() {
            return jedisCluster.ping();
        }

        @Override
        public String quit() {
            return jedisCluster.quit();
        }

        @Override
        public byte[] rpop(byte[] key) {
            return jedisCluster.rpop(key);
        }

        @Override
        public String rpop(String key) {
            return jedisCluster.rpop(key);
        }

        @Override
        public Long rpush(byte[] key, byte[]... args) {
            return jedisCluster.rpush(key, args);
        }

        @Override
        public Long rpush(String key, String... string) {
            return jedisCluster.rpush(key, string);
        }

        @Override
        public Long rpushx(byte[] key, byte[]... arg) {
            return jedisCluster.rpushx(key, arg);
        }

        @Override
        public Long rpushx(String key, String... string) {
            return jedisCluster.rpushx(key, string);
        }

        @Override
        public Long sadd(byte[] key, byte[]... member) {
            return jedisCluster.sadd(key, member);
        }

        @Override
        public Long sadd(String key, String... member) {
            return jedisCluster.sadd(key, member);
        }

        @Override
        public String save() {
            return jedisCluster.save();
        }

        @Override
        public Long scard(byte[] key) {
            return jedisCluster.scard(key);
        }

        @Override
        public Long scard(String key) {
            return jedisCluster.scard(key);
        }

        @Override
        public String select(int index) {
            return jedisCluster.select(index);
        }

        @Override
        public String set(byte[] key, byte[] value) {
            return jedisCluster.set(key, value);
        }

        @Override
        public String set(byte[] key, byte[] value, byte[] nxxx, byte[] expx, long time) {
            return jedisCluster.set(key, value, nxxx, expx, time);
        }

        @Override
        public String set(String key, String value) {
            return jedisCluster.set(key, value);
        }

        @Override
        public String set(String key, String value, String nxxx, String expx, long time) {
            return jedisCluster.set(key, value, nxxx, expx, time);
        }

        @Override
        public Boolean setbit(byte[] key, long offset, boolean value) {
            return jedisCluster.setbit(key, offset, value);
        }

        @Override
        public Boolean setbit(byte[] key, long offset, byte[] value) {
            return jedisCluster.setbit(key, offset, value);
        }

        @Override
        public Boolean setbit(String key, long offset, boolean value) {
            return jedisCluster.setbit(key, offset, value);
        }

        @Override
        public Boolean setbit(String key, long offset, String value) {
            return jedisCluster.setbit(key, offset, value);
        }

        @Override
        public String setex(byte[] key, int seconds, byte[] value) {
            return jedisCluster.setex(key, seconds, value);
        }

        @Override
        public String setex(String key, int seconds, String value) {
            return jedisCluster.setex(key, seconds, value);
        }

        @Override
        public Long setnx(byte[] key, byte[] value) {
            return jedisCluster.setnx(key, value);
        }

        @Override
        public Long setnx(String key, String value) {
            return jedisCluster.setnx(key, value);
        }

        @Override
        public Long setrange(byte[] key, long offset, byte[] value) {
            return jedisCluster.setrange(key, offset, value);
        }

        @Override
        public Long setrange(String key, long offset, String value) {
            return jedisCluster.setrange(key, offset, value);
        }

        @Override
        public void setSerializerFunction(Function<String, Serializer> serializerFunction) {
            jedisCluster.setSerializerFunction(serializerFunction);
        }

        @Override
        public String shutdown() {
            return jedisCluster.shutdown();
        }

        @Override
        public Boolean sismember(byte[] key, byte[] member) {
            return jedisCluster.sismember(key, member);
        }

        @Override
        public Boolean sismember(String key, String member) {
            return jedisCluster.sismember(key, member);
        }

        @Override
        public String slaveof(String host, int port) {
            return jedisCluster.slaveof(host, port);
        }

        @Override
        public String slaveofNoOne() {
            return jedisCluster.slaveofNoOne();
        }

        @Override
        public Set<byte[]> smembers(byte[] key) {
            return jedisCluster.smembers(key);
        }

        @Override
        public Set<String> smembers(String key) {
            return jedisCluster.smembers(key);
        }

        @Override
        public List<byte[]> sort(byte[] key) {
            return jedisCluster.sort(key);
        }

        @Override
        public List<byte[]> sort(byte[] key, SortingParams sortingParameters) {
            return jedisCluster.sort(key, sortingParameters);
        }

        @Override
        public List<String> sort(String key) {
            return jedisCluster.sort(key);
        }

        @Override
        public List<String> sort(String key, SortingParams sortingParameters) {
            return jedisCluster.sort(key, sortingParameters);
        }

        @Override
        public byte[] spop(byte[] key) {
            return jedisCluster.spop(key);
        }

        @Override
        public Set<byte[]> spop(byte[] key, long count) {
            return jedisCluster.spop(key, count);
        }

        @Override
        public String spop(String key) {
            return jedisCluster.spop(key);
        }

        @Override
        public Set<String> spop(String key, long count) {
            return jedisCluster.spop(key, count);
        }

        @Override
        public byte[] srandmember(byte[] key) {
            return jedisCluster.srandmember(key);
        }

        @Override
        public List<byte[]> srandmember(byte[] key, int count) {
            return jedisCluster.srandmember(key, count);
        }

        @Override
        public String srandmember(String key) {
            return jedisCluster.srandmember(key);
        }

        @Override
        public List<String> srandmember(String key, int count) {
            return jedisCluster.srandmember(key, count);
        }

        @Override
        public Long srem(byte[] key, byte[]... member) {
            return jedisCluster.srem(key, member);
        }

        @Override
        public Long srem(String key, String... member) {
            return jedisCluster.srem(key, member);
        }

        @Override
        public ScanResult<String> sscan(String key, int cursor) {
            return jedisCluster.sscan(key, cursor);
        }

        @Override
        public ScanResult<String> sscan(String key, String cursor) {
            return jedisCluster.sscan(key, cursor);
        }

        @Override
        public Long strlen(byte[] key) {
            return jedisCluster.strlen(key);
        }

        @Override
        public Long strlen(String key) {
            return jedisCluster.strlen(key);
        }

        @Override
        public byte[] substr(byte[] key, int start, int end) {
            return jedisCluster.substr(key, start, end);
        }

        @Override
        public String substr(String key, int start, int end) {
            return jedisCluster.substr(key, start, end);
        }

        @Override
        public Long ttl(byte[] key) {
            return jedisCluster.ttl(key);
        }

        @Override
        public Long ttl(String key) {
            return jedisCluster.ttl(key);
        }

        @Override
        public String type(byte[] key) {
            return jedisCluster.type(key);
        }

        @Override
        public String type(String key) {
            return jedisCluster.type(key);
        }

        @Override
        public Long waitReplicas(int replicas, long timeout) {
            return jedisCluster.waitReplicas(replicas, timeout);
        }

        @Override
        public Long zadd(byte[] key, double score, byte[] member) {
            return jedisCluster.zadd(key, score, member);
        }

        @Override
        public Long zadd(byte[] key, Map<byte[], Double> scoreMembers) {
            return jedisCluster.zadd(key, scoreMembers);
        }

        @Override
        public Long zadd(String key, double score, String member) {
            return jedisCluster.zadd(key, score, member);
        }

        @Override
        public Long zadd(String key, Map<String, Double> scoreMembers) {
            return jedisCluster.zadd(key, scoreMembers);
        }

        @Override
        public Long zcard(byte[] key) {
            return jedisCluster.zcard(key);
        }

        @Override
        public Long zcard(String key) {
            return jedisCluster.zcard(key);
        }

        @Override
        public Long zcount(byte[] key, byte[] min, byte[] max) {
            return jedisCluster.zcount(key, min, max);
        }

        @Override
        public Long zcount(byte[] key, double min, double max) {
            return jedisCluster.zcount(key, min, max);
        }

        @Override
        public Long zcount(String key, double min, double max) {
            return jedisCluster.zcount(key, min, max);
        }

        @Override
        public Long zcount(String key, String min, String max) {
            return jedisCluster.zcount(key, min, max);
        }

        @Override
        public Double zincrby(byte[] key, double score, byte[] member) {
            return jedisCluster.zincrby(key, score, member);
        }

        @Override
        public Double zincrby(String key, double score, String member) {
            return jedisCluster.zincrby(key, score, member);
        }

        @Override
        public Long zlexcount(byte[] key, byte[] min, byte[] max) {
            return jedisCluster.zlexcount(key, min, max);
        }

        @Override
        public Long zlexcount(String key, String min, String max) {
            return jedisCluster.zlexcount(key, min, max);
        }

        @Override
        public Set<byte[]> zrange(byte[] key, long start, long end) {
            return jedisCluster.zrange(key, start, end);
        }

        @Override
        public Set<String> zrange(String key, long start, long end) {
            return jedisCluster.zrange(key, start, end);
        }

        @Override
        public Set<byte[]> zrangeByLex(byte[] key, byte[] min, byte[] max) {
            return jedisCluster.zrangeByLex(key, min, max);
        }

        @Override
        public Set<byte[]> zrangeByLex(byte[] key, byte[] min, byte[] max, int offset, int count) {
            return jedisCluster.zrangeByLex(key, min, max, offset, count);
        }

        @Override
        public Set<String> zrangeByLex(String key, String min, String max) {
            return jedisCluster.zrangeByLex(key, min, max);
        }

        @Override
        public Set<String> zrangeByLex(String key, String min, String max, int offset, int count) {
            return jedisCluster.zrangeByLex(key, min, max, offset, count);
        }

        @Override
        public Set<byte[]> zrangeByScore(byte[] key, byte[] min, byte[] max) {
            return jedisCluster.zrangeByScore(key, min, max);
        }

        @Override
        public Set<byte[]> zrangeByScore(byte[] key, byte[] min, byte[] max, int offset, int count) {
            return jedisCluster.zrangeByScore(key, min, max, offset, count);
        }

        @Override
        public Set<byte[]> zrangeByScore(byte[] key, double min, double max) {
            return jedisCluster.zrangeByScore(key, min, max);
        }

        @Override
        public Set<byte[]> zrangeByScore(byte[] key, double min, double max, int offset, int count) {
            return jedisCluster.zrangeByScore(key, min, max, offset, count);
        }

        @Override
        public Set<String> zrangeByScore(String key, double min, double max) {
            return jedisCluster.zrangeByScore(key, min, max);
        }

        @Override
        public Set<String> zrangeByScore(String key, double min, double max, int offset, int count) {
            return jedisCluster.zrangeByScore(key, min, max, offset, count);
        }

        @Override
        public Set<String> zrangeByScore(String key, String min, String max) {
            return jedisCluster.zrangeByScore(key, min, max);
        }

        @Override
        public Set<String> zrangeByScore(String key, String min, String max, int offset, int count) {
            return jedisCluster.zrangeByScore(key, min, max, offset, count);
        }

        @Override
        public Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max) {
            return jedisCluster.zrangeByScoreWithScores(key, min, max);
        }

        @Override
        public Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, int offset, int count) {
            return jedisCluster.zrangeByScoreWithScores(key, min, max, offset, count);
        }

        @Override
        public Set<Tuple> zrangeByScoreWithScores(byte[] key, double min, double max) {
            return jedisCluster.zrangeByScoreWithScores(key, min, max);
        }

        @Override
        public Set<Tuple> zrangeByScoreWithScores(byte[] key, double min, double max, int offset, int count) {
            return jedisCluster.zrangeByScoreWithScores(key, min, max, offset, count);
        }

        @Override
        public Set<Tuple> zrangeByScoreWithScores(String key, double min, double max) {
            return jedisCluster.zrangeByScoreWithScores(key, min, max);
        }

        @Override
        public Set<Tuple> zrangeByScoreWithScores(String key, double min, double max, int offset, int count) {
            return jedisCluster.zrangeByScoreWithScores(key, min, max, offset, count);
        }

        @Override
        public Set<Tuple> zrangeByScoreWithScores(String key, String min, String max) {
            return jedisCluster.zrangeByScoreWithScores(key, min, max);
        }

        @Override
        public Set<Tuple> zrangeByScoreWithScores(String key, String min, String max, int offset, int count) {
            return jedisCluster.zrangeByScoreWithScores(key, min, max, offset, count);
        }

        @Override
        public Set<Tuple> zrangeWithScores(byte[] key, long start, long end) {
            return jedisCluster.zrangeWithScores(key, start, end);
        }

        @Override
        public Set<Tuple> zrangeWithScores(String key, long start, long end) {
            return jedisCluster.zrangeWithScores(key, start, end);
        }

        @Override
        public Long zrank(byte[] key, byte[] member) {
            return jedisCluster.zrank(key, member);
        }

        @Override
        public Long zrank(String key, String member) {
            return jedisCluster.zrank(key, member);
        }

        @Override
        public Long zrem(byte[] key, byte[]... member) {
            return jedisCluster.zrem(key, member);
        }

        @Override
        public Long zrem(String key, String... member) {
            return jedisCluster.zrem(key, member);
        }

        @Override
        public Long zremrangeByLex(byte[] key, byte[] min, byte[] max) {
            return jedisCluster.zremrangeByLex(key, min, max);
        }

        @Override
        public Long zremrangeByLex(String key, String min, String max) {
            return jedisCluster.zremrangeByLex(key, min, max);
        }

        @Override
        public Long zremrangeByRank(byte[] key, long start, long end) {
            return jedisCluster.zremrangeByRank(key, start, end);
        }

        @Override
        public Long zremrangeByRank(String key, long start, long end) {
            return jedisCluster.zremrangeByRank(key, start, end);
        }

        @Override
        public Long zremrangeByScore(byte[] key, byte[] start, byte[] end) {
            return jedisCluster.zremrangeByScore(key, start, end);
        }

        @Override
        public Long zremrangeByScore(byte[] key, double start, double end) {
            return jedisCluster.zremrangeByScore(key, start, end);
        }

        @Override
        public Long zremrangeByScore(String key, double start, double end) {
            return jedisCluster.zremrangeByScore(key, start, end);
        }

        @Override
        public Long zremrangeByScore(String key, String start, String end) {
            return jedisCluster.zremrangeByScore(key, start, end);
        }

        @Override
        public Set<byte[]> zrevrange(byte[] key, long start, long end) {
            return jedisCluster.zrevrange(key, start, end);
        }

        @Override
        public Set<String> zrevrange(String key, long start, long end) {
            return jedisCluster.zrevrange(key, start, end);
        }

        @Override
        public Set<byte[]> zrevrangeByLex(byte[] key, byte[] max, byte[] min) {
            return jedisCluster.zrevrangeByLex(key, max, min);
        }

        @Override
        public Set<byte[]> zrevrangeByLex(byte[] key, byte[] max, byte[] min, int offset, int count) {
            return jedisCluster.zrevrangeByLex(key, max, min, offset, count);
        }

        @Override
        public Set<String> zrevrangeByLex(String key, String max, String min) {
            return jedisCluster.zrevrangeByLex(key, max, min);
        }

        @Override
        public Set<String> zrevrangeByLex(String key, String max, String min, int offset, int count) {
            return jedisCluster.zrevrangeByLex(key, max, min, offset, count);
        }

        @Override
        public Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min) {
            return jedisCluster.zrevrangeByScore(key, max, min);
        }

        @Override
        public Set<byte[]> zrevrangeByScore(byte[] key, byte[] max, byte[] min, int offset, int count) {
            return jedisCluster.zrevrangeByScore(key, max, min, offset, count);
        }

        @Override
        public Set<byte[]> zrevrangeByScore(byte[] key, double max, double min) {
            return jedisCluster.zrevrangeByScore(key, max, min);
        }

        @Override
        public Set<byte[]> zrevrangeByScore(byte[] key, double max, double min, int offset, int count) {
            return jedisCluster.zrevrangeByScore(key, max, min, offset, count);
        }

        @Override
        public Set<String> zrevrangeByScore(String key, double max, double min) {
            return jedisCluster.zrevrangeByScore(key, max, min);
        }

        @Override
        public Set<String> zrevrangeByScore(String key, double max, double min, int offset, int count) {
            return jedisCluster.zrevrangeByScore(key, max, min, offset, count);
        }

        @Override
        public Set<String> zrevrangeByScore(String key, String max, String min) {
            return jedisCluster.zrevrangeByScore(key, max, min);
        }

        @Override
        public Set<String> zrevrangeByScore(String key, String max, String min, int offset, int count) {
            return jedisCluster.zrevrangeByScore(key, max, min, offset, count);
        }

        @Override
        public Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min) {
            return jedisCluster.zrevrangeByScoreWithScores(key, max, min);
        }

        @Override
        public Set<Tuple> zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min, int offset, int count) {
            return jedisCluster.zrevrangeByScoreWithScores(key, max, min, offset, count);
        }

        @Override
        public Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min) {
            return jedisCluster.zrevrangeByScoreWithScores(key, max, min);
        }

        @Override
        public Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min, int offset, int count) {
            return jedisCluster.zrevrangeByScoreWithScores(key, max, min, offset, count);
        }

        @Override
        public Set<Tuple> zrevrangeByScoreWithScores(String key, double max, double min) {
            return jedisCluster.zrevrangeByScoreWithScores(key, max, min);
        }

        @Override
        public Set<Tuple> zrevrangeByScoreWithScores(String key, double max, double min, int offset, int count) {
            return jedisCluster.zrevrangeByScoreWithScores(key, max, min, offset, count);
        }

        @Override
        public Set<Tuple> zrevrangeByScoreWithScores(String key, String max, String min) {
            return jedisCluster.zrevrangeByScoreWithScores(key, max, min);
        }

        @Override
        public Set<Tuple> zrevrangeByScoreWithScores(String key, String max, String min, int offset, int count) {
            return jedisCluster.zrevrangeByScoreWithScores(key, max, min, offset, count);
        }

        @Override
        public Set<Tuple> zrevrangeWithScores(byte[] key, long start, long end) {
            return jedisCluster.zrevrangeWithScores(key, start, end);
        }

        @Override
        public Set<Tuple> zrevrangeWithScores(String key, long start, long end) {
            return jedisCluster.zrevrangeWithScores(key, start, end);
        }

        @Override
        public Long zrevrank(byte[] key, byte[] member) {
            return jedisCluster.zrevrank(key, member);
        }

        @Override
        public Long zrevrank(String key, String member) {
            return jedisCluster.zrevrank(key, member);
        }

        @Override
        public ScanResult<Tuple> zscan(String key, int cursor) {
            return jedisCluster.zscan(key, cursor);
        }

        @Override
        public ScanResult<Tuple> zscan(String key, String cursor) {
            return jedisCluster.zscan(key, cursor);
        }

        @Override
        public Double zscore(byte[] key, byte[] member) {
            return jedisCluster.zscore(key, member);
        }

        @Override
        public Double zscore(String key, String member) {
            return jedisCluster.zscore(key, member);
        }

        @Override
        public <T> BiFunction<byte[], Class<T>, T> getDataDecode(String key) {
            return null;
        }

        @Override
        public Function<Object, byte[]> getDataEncode(String key) {
            return null;
        }
    }
}
